import time
from time import sleep

import pytest
from playwright.sync_api import sync_playwright


class Test:
    @pytest.fixture(scope='function',autouse=True)
    def setup_teardown(self):
        self.pd=sync_playwright().start()
        self.page=self.pd.chromium.launch(headless=True)
        self.p=self.page.new_page()
        yield
        sleep(5)
        self.page.close()
        self.p.close()
    def test_case_a3mall_01(self):
        self.p.goto('https://www.jiuxian.com/')
        self.p.locator('text=请登录').nth(0).click()
        dy1=self.p.locator('text=帐号登录').nth(0).text_content()
        assert dy1=='帐号登录'
        self.p.locator('xpath=/html/body/div/form/div/div/div/div/div[1]/div[2]/div[1]/input').nth(0).fill('19834511018')
        self.p.locator('xpath=/html/body/div/form/div/div/div/div/div[1]/div[2]/div[2]/input[1]').nth(0).fill('khl131488..')
        sleep(10)
        self.p.locator('xpath=/html/body/div/form/div/div/div/div/div[1]/div[2]/div[4]/input').nth(0).click()